package com.zjitc.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016082600315945";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCpbq/8EAqdFqGTvs3c95PZz6W2+uhV9+djvwTGGBJ6D8KKI3JUGPZxqPxnsjgMmuN6Nv9eVyPb0qxudjlKQnBHEjvJsXJKPwgz/mnI+ppkbucOJIK2dEvSFRcKm/kjOEB/CwfRONZJD+HA98WhQAEgTKwVnj9ELKlsoFhOi32grYPTKYxkFixEaI9P1Fr80qAlghF9K3dDFp8Y1CR942amoJkmUPSKCFjAL/w3ZJ8hFjzpYWw1dYFKbqO1L2haHDMxo20Vi8rA3/0zKQcAGKkRyKAZO90ThRmHJ8iKigYms+k4rjnUy2ExPDMetofi+r16hy/9lo0STWCInp+io2JjAgMBAAECggEAedECKHkkGGNgEki53CgIni5kF9X3229cZuO8u+wsxKO2G/l2Rq6X6Yo0xx1knPNzn7gRDLQcLP0gSl8nu5NfBEpAwDebU3RUIoXFauF6xcDS0OFBNYsRxF6zbUZM7pyQCodUvIFf17HafxHlfpT0+lMF2pknJY3y1g3Gz9oMnctXBes1hrnP/Ev0BuNq2C/6MOkJtMHwzmNpg93r8709LVCmMK2jzrFJmij6QDN5y/vzzD+HQHsqkUJLn2QZ3AQPymQbND1LCNdDhJybcTKHNrgEbrioLL528WAdLt81AgimBAyn0vhaoFv49X7ujYvQDg70Jh0Nt3tcyQkFgK1NUQKBgQDeHfBlTfjsD6AXKbc+VKmc/QWNyBJ5jjPhz8+tQlT96f3Z7hiZX0bVt6te9xYuzNsowJPEpIlVmdD2EAmgkjF/vgIK4nOQFS3URw7dP0wbia1ORHPKeHgDh2zp1XUik3WPUtoGurPRXprK60FNttyAGhBhN1NqH5FJxmGOtRI5uQKBgQDDR1J8DeMD9sJ6+DDu5BfaSpU+DSXIZq/EW4fp/GmNP9hK2OdRyw6/HAqQXlNUG3Ts9tme8Diwg84LQiBTAfgqRof8fEwBMvox2toA/tQPIV8zCyIgR0qtPVy5FWLBkYHA2xLAQ/l3AvcReHxGDURrg9axzLRqpTA2qNLikyga+wKBgAFZUTJsTMyyM5iwaip4vSb06mm4A1S1pl8CshItSvLXzvDZ31BfIcD+go3rFjlmiRYwRTV2glcAviIgas6M1Lwf3UdPpMAFQOf/Hnn9fmrUZTcKd2GNZb0vv1uULkfteVNLf4N28syctHfzAcyFBcXJYrwUZ+9HDczS5ZjGRLwRAoGBAKINZAQSuhumAUpvAJyeqLS8RBGUc5BUtvQqSSYCE83l96ZVTdFwwzIRISshO+GGT4f+aiYdj83b83cgTxbTgZADrAH5XFF6bmpFBbjhwDU2Knx/drh2sSAG1hW6C5Q7HgRfSLZJMpJy4XmcFPVFOUxHwjkWeXouz03s1+Sy3gtVAoGBAJ7eFUOdZse6rRoArCQ53VN22aOQE2X0rYjRZUzUME6bDXTuYMZR+hElIoilfdV2jk1OCSxwJqKepq96KtBVuYwVdnd2zWj5cm7FX7oJqf1rCnf+rodpUWljn/Goqc8CJZd76m4BvAs+oxYr8uudUmOpWsKQ+vilfYFqDCc/Bvhn";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4dN/YAJS8n/1MX3b1znL6D5DT7vTqD9gTmmP7MBi3o/nu4QCgOMKhzliKSLH0ijUhiXu00lb9GhxuOwVGu5/rfri/fnLQtV8bwOkvmibdnu2Y6bG+zd7kJc5mpuZtv++bVIniI16OnXZXt0Sid5IxDxsjBufe1uE9Txdo7ulExo1g/7kgj7fkB5ihmIcVC521NKFbfmvgaWbfTUGsj/N+yYCsuDlznWrZhPxTw1lVC1VPcgXoXdFtgu3/0XtvoXoVeNal/DlbXknkEsZVNwD2RaTY8hOJteeX+038RtEhRRJ/F8pYbaiFjfaKH7Pf35ukcr1SEo/FCEu25/eZf2XowIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/product/pay.do";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/product/showComment.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

